package com.example.design.behavior.state.enums;

/**
 * \* @author: bear
 * \* Date: 2021-01-22-10:42
 * \* describe:
 */
public class Context {
	protected State state;

	public Context() {
		state = State.new_built;
	}

	public void start(){
		State st = state.start();
		if(st!=null){
			this.state = st;
		}
	}

	public void getCpu(){
		State st = state.getCpu();
		if(st!=null){
			this.state = st;
		}
	}

	public void stop(){
		State st = state.stop();
		if(st!=null){
			this.state = st;
		}
	}

	public void resume(){
		State st = state.resume();
		if(st!=null){
			this.state = st;
		}
	}

	public void suspend(){
		State st = state.suspend();
		if(st!=null){
			this.state = st;
		}
	}
}
